/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pbl;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;


public class PersonServer {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{
		int serverPort = 7897;
	    ArrayList personList = new ArrayList();
	    ServerSocket serverSocket = new ServerSocket( serverPort );
	    System.out.println("PersonServer up and running...");
	    
	    while ( true ) {
                System.out.println("Content: "+personList);
                System.out.println("Waiting for client to connect...");
                
	    	Socket socket = serverSocket.accept(); // blocking call
	    	PersonHandler handler = new PersonHandler(socket, personList);
	    	new Thread(handler).start();
                try { Thread.sleep(1000); }
                catch (InterruptedException e) {}
	    }
	}
}
